package com.zhangwei.day38;

import android.app.Application;

import com.lidroid.xutils.DbUtils;
import com.zhangwei.day38.utils.AppConfig;
import com.zhangwei.day38.utils.FileUtils;
import com.zhangwei.day38.utils.XutilsHelper;

/**
 * @author zhangwei
 * @version V1.0
 * @Title: Advanced
 * @Package com.zhangwei.day38
 * @Description:
 * @date 15/10/20 上午11:07
 */

public class BaseApp extends Application {
    public static BaseApp app;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        XutilsHelper.getInstance().GonfigGlobalBitmap(this);
    }

    public static BaseApp getInstance() {
        return app;
    }


    public DbUtils getDbUtils() {
        DbUtils.DaoConfig config = new DbUtils.DaoConfig(this);
        config.setDbName(AppConfig.DB_NAME);
        config.setDbVersion(AppConfig.DB_VERSION);
        config.setDbDir(FileUtils.getDBPath(this));
        config.setDbUpgradeListener(new DbUtils.DbUpgradeListener() {
            @Override
            public void onUpgrade(DbUtils db, int oldVersion, int newVersion) {

            }
        });
        return DbUtils.create(config);
    }

}
